package world.placement;

/**
 * Enumeration class representing different directions of a square.
 * 
 * @version  1.0
 * @author   Wim Marynissen, Frederic Mes
 */

public enum Direction {
	NORTH, EAST, SOUTH, WEST, CEILING, FLOOR;

	/**
	 * Get the opposite direction.
	 * 
	 * @return The opposite direction of this direction.
	 */
	public Direction getOpposite() {
		switch (this) {
		case NORTH:
			return SOUTH;
		case SOUTH:
			return NORTH;
		case EAST:
			return WEST;
		case WEST:
			return EAST;
		case CEILING:
			return FLOOR;
		}
		return CEILING;
	}
	
	/**
	 * Indicates if the specified direction is equal to, or opposite of this direction.
	 * @param 	direction
	 * 			The direction to check.
	 * @return	True if the direction is equal to this direction or the opposite.
	 * 			| result == (this.equals(direction) || getOpposite().equals(direction))
	 */
	public boolean isDirectionOrOppositeOf(Direction direction){
		return (this.equals(direction) || getOpposite().equals(direction));
	}
}

